import {mapGetters} from 'vuex'

export default{
	computed:{
		...mapGetters('m_cart',['total'])
	},
	onShow(){
		this.setBadge()
	},
	watch:{
		total(){
			this.setBadge()
		}
	},
	data() {
		return {
			
		};
	},
	methods:{
		setBadge(){
			//调用uni.setTabBarBadge()方法，为购物车设置右上角的徽标
			uni.setTabBarBadge({
				index: 2,
				//text只能是字符串，转换成字符串
				text: this.total + ''
			})
		}
	}
}